{include file="Public/header" title="班级列表"/}
    
    <div  id="container"  class="container-fluid">
      <div  class="row-fluid">

<!-- 左侧导航栏 start -->
{include file="Public/sidebar"/}
<!-- 左侧导航栏 end -->

<div  id="content"  class="span10">
  <div class="pageTit page-header">
    <h1>班级管理 </h1>
    <div  class="opt">
      <a  class="btn btn-info"  href="{:U('admin/class/add')}">添加班级</a>
    </div>
  </div>
  
  
  <div  class="dataBox">
    <table  class="table table-bordered table-striped center">
      <thead>
        <tr>
          <th>班级ID</th>
          <th>班级名称</th>
          <th>添加时间</th>
          <th>所属专业</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
      {if condition="$class_list"}
        {foreach name="class_list" item="vo" }
        <tr id="tr_{$vo.Id}">
          <td><a href="#">{$vo.Id}</a></td>
          <td>{$vo.name}</td>
          <td>{$vo.add_time}</td>
          <td>{:get_title('Major',$vo['major_id'])}</td>
          <td>
          	<a title="编辑" class=" btn btn-mini btn-info js_edit" href="{:U("admin/class/edit?id=$vo[Id]")}">编辑</a>
            <a title="删除" class=" btn btn-mini btn-danger js_del" id="{$vo.Id}">删除</a>
          </td>
        </tr>
        {/foreach}
        {else/}
        <tr>
          <td colspan="13">暂无相关班级信息</td>
        </tr>
        {/if}
        
      </tbody>
    </table>
  </div>
  {include file="Public/page"/}
  
</div>
      </div>
    </div>
<script>
    $(function(){
      $('.btn-danger').click(function () {
        var result = confirm("删除是不可恢复的,你确认要删除吗?");
        if (!result) {
          return false;
        }
        else {
          var id = $(this).attr('id')
          $.ajax({
            type: "post",
            url: "__APP__/Admin/class/del",
            async: true,
            data: {id: id},
            datatype: "json",
            success: function (data) {
              if (data.status == 1) {
                $("#tr_" + id).remove();
              }
              alert(data.data);
            },
            error: function () {
              alert("班级删除失败,请刷新重试");
            }
          });
        }
      });
    
    });
</script>    
{include file="Public/footer"/}